<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
    </script>

    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">

    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

    <link rel="stylesheet" th:href="@{/plugins/imgUpload/public/index.css}">
</head>
<body>
<div class="row" >
    <br>
    <br>
    <div class="col-md-1"></div>
    <div class="col-md-10">
        <form class="form-horizontal" method="post" th:action="@{/admin/addTag}" enctype="multipart/form-data" >

            <div class="form-group">
                <label  class="col-sm-2 control-label">标签名称</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="tag" placeholder="请输入内容">
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label">封面</label>
<!--                <div class="col-sm-10 upload imgLog2 ">-->
<!--                    <span><i class="glyphicon glyphicon-open"></i>上传头像</span>-->
<!--                </div>-->
                <div class="col-sm-10">
                    <div class="upload imgLog2">
                        <span><i class="glyphicon glyphicon-open"></i>上传封面</span>
                    </div>
                </div>
            </div>

            <div class="form-group ">
                <div class="col-sm-offset-2 col-sm-10 pull-right">
                    <button type="button" class="btn btn-warning"  onclick="window.history.go(-1)">返回</button>
                    <button type="submit" class="btn btn-info">提交</button>
                </div>
            </div>
        </form>
    </div>
    <div class="col-md-1"></div>
</div>
<script th:src="@{/plugins/imgUpload/public/index.js}"></script>
<script>
    $(function(){
        var img1 = new ImgUpload('.imgLog',210,55,55);
        var img2 = new ImgUpload('.imgLog2',100,100,100);
        var img3 = new ImgUpload('.imgLog3',400,200,200);

        $(document).on('change',".imgLog input",function(e){
            //模拟后台返回url
            var url = window.URL.createObjectURL(e.target.files[0]);
            $(this).parent().css('background','url('+url+')0% 0% / cover')
            console.log(window.URL.createObjectURL(e.target.files[0]))

            img1.setSpan(this)
        })

        $(document).on('change',".imgLog2 input",function(e){
            //模拟后台返回url
            var url = window.URL.createObjectURL(e.target.files[0]);
            $(this).parent().css('background','url('+url+')0% 0% / cover')
            img2.setSpan(this)
        })

        $(document).on('change',".imgLog3 input",function(e){
            //模拟后台返回url
            var url = window.URL.createObjectURL(e.target.files[0]);
            $(this).parent().css('background','url('+url+')0% 0% / cover')

            img3.setSpan(this)
        })

    })

</script>



</body>
</html>